import os
import sqlite3

__author__ = 'gongqf'
print os.getcwd()
if os.path.exists(r'e:\web\flask\topshipping'):
    os.chdir(r'e:\web\flask\topshipping')
elif os.path.exists(r'l:\web\flask\topshipping'):
    os.chdir(r'l:\web\flask\topshipping')
elif os.path.exists(r'g:\web\flask\topshipping'):
    os.chdir(r'g:\web\flask\topshipping')

conn=sqlite3.connect('topshipping.db3')

countrys=open(r'static\country.txt').readlines()
for country in countrys:
    print country.decode('gbk').strip('\n')

    conn.execute('replace into country(countryname) values(?)',(country.decode('gbk').strip('\n'),))
conn.commit()